#! /usr/bin/env python
# -*- coding:utf-8 -*-
# Author Jmz

class mysql(object):
    __instance = None
    def __init__(self):
        pass

    @classmethod
    def get_instance(cls,*args,**kwargs):
        if not cls.__instance:
            cls.__instance = cls(*args,**kwargs)
        return cls.__instance


mysql = mysql.get_instance()
print(mysql)
# <__main__.mysql object at 0x00000000022D7BE0>
mysql = mysql.get_instance()
print(mysql)
# <__main__.mysql object at 0x00000000022D7BE0>


# 说明两个返回的内容地址是一样的，说明只实例化了一次。

